<?php
class Occupation_model extends Model {
	function readByStateId($stateId) {
		$query = $this->db->get('occupations'); // TODO:
		return $query->result();
	}

	function read($id) {
		$query = $this->db->getwhere('occupations', array('id' => $id));
		return $query->row();
	}

	function readAll() {
		$query = $this->db->get('occupations');
		return $query->result();
	}

	function create() {
		$data = array(
			'name' => $this->input->post('name')
		);
		$this->db->insert('occupations', $data);
	}

	function update($id) {
		$data = array(
			'name' => $this->input->post('name')
		);
		$this->db->update('occupations', $data, array('id' => $id));
	}
}
?>
